package com.mc.common.exception;


import com.mc.common.base.BaseConstant;
import com.mc.common.base.ResultEnum;

public class BusinessException extends Exception {
    private static final long serialVersionUID = 1L;

    private int errorCode = BaseConstant.STATUS_FAIlURE_CODE;

    public BusinessException(int errorCode) {
        super();
        setErrorCode(errorCode);
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(int errorCode, String message) {
        super(message);
        setErrorCode(errorCode);
    }

    public BusinessException(ResultEnum resultEnum) {
        super(resultEnum.getName());
        setErrorCode(resultEnum.getCode());
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(int errorCode, String message, Throwable cause) {
        super(message, cause);

        setErrorCode(errorCode);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
}
